/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       bitmap_pool.h

	$Header: /game/bitmap_pool.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef BITMAP_POOL_H_INCLUDED
#define BITMAP_POOL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include "bitmap_layer_ptr.h"
#include "bitmap_layer_cache.h"
#include "shared_ptr.h"
#include "string_pair.h"

class t_bitmap_group_cache;

// --------------------------------------------------------------------
// class to return bitmap_layer_ptr's from multiple bitmap group sources
// construct with reference to bitmap_group_cache array, and list of 
// layers contained therin.
// --------------------------------------------------------------------
class t_bitmap_pool
{
public:
	t_bitmap_pool();
	t_bitmap_pool( t_bitmap_group_cache const* caches, t_char_ptr_pair const* pairs, int count );
	t_bitmap_pool( t_bitmap_group_cache const* caches, t_string_pair const* pairs, int count );

	// return an ID for get
	int						find( std::string const& name ) const;
	t_bitmap_layer_ptr		get( int id ) const;
	t_bitmap_layer_cache    get_cache( int id ) const;
protected:
	std::vector<t_bitmap_layer_cache> m_bitmaps;
	std::vector<int>                  m_index;
};

inline t_bitmap_layer_cache t_bitmap_pool::get_cache( int id ) const
{
	return m_bitmaps[id];
}


#endif // BITMAP_POOL_H_INCLUDED